package com.bsoft.exchange.dao.his;

import com.bsoft.exchange.domain.*;
import com.bsoft.exchange.pojo.HospitalizationAppointmentPojo;
import com.bsoft.exchange.pojo.HospitalizationDepositPojo;
import com.bsoft.exchange.pojo.PaySettlementPojo;
import org.apache.ibatis.annotations.Param;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;

/**
 * 创建日期 : 2019/10/14
 * 创建人 : 赵太行
 * 关于住院的
 */
public interface HospitalizationMapper {
    /**
     * 获取住院记录
     * @param jgid
     * @param brid
     * @return
     */
    List<HospitalizationRecordDomain>getHospitalizationInfo(@Param("JGID")String jgid,@Param("BRID")String brid,
                                                            @Param("queryType")Integer queryType,@Param("ZYHM")String zyhm);
    /**
     * 获取电子住院证信息
     */
    ElectronicProofDomain getElectronicProof(@Param("JGID")String jgid,@Param("BRID")String brid) throws SQLException;
    /**
     * 住院预约
     */
    Integer appointmentSubmit(@Param("BRID")Integer brid,@Param("MZHM")String mzhm,
                              @Param("BRXZ")Integer brxz,@Param("BRXM")String brxm,@Param("BRXB")Integer brxb,
                              @Param("CSNY")String csny,@Param("KDYS")String KDYS,@Param("BRNL")Integer BRNL,
                              @Param("pojo")HospitalizationAppointmentPojo pojo);
    /**
     * 更新住院预约
     */
    Integer updataAppointment(@Param("pojo")HospitalizationAppointmentPojo pojo);
    /**
     * 查询是否可以进行预约
     */
    RyZytzDoamin selectNotAppointmentCancel(@Param("JGID")String jgid,@Param("ZYZH")String zyzh)throws SQLException;

    /**
     * 取消住院预约
     */
    Integer appointmentCancel(@Param("JGID")String jgid,@Param("ZYZH")String zyzh)throws SQLException;
    /**
     * 获取住院预缴金记录
     */
    List<AdvancedPaymentListDomain> listPaymentHistory(@Param("JGID")String jgid,@Param("BRID")String brid,@Param("ZYH")String zyh,
                                                        @Param("queryType")Integer queryType) throws SQLException;

    /**
     * 获取出院带药信息
     */
    List<GetDischargeMedDomain> getDischargeMedicationInformation(@Param("JGID")String jgid,@Param("BRID")String brid,@Param("ZYH")String zyh,
                                                       @Param("queryType")Integer queryType) throws SQLException;

    /**
     * 获取每日费用
     */
    HospitalizationPaymentDateDoamin listHospitalizationPaymentDate(@Param("JGID")String jgid,@Param("BRID")String brid,@Param("ZYH")String zyh,
                                                                         @Param("queryType")Integer queryType,@Param("KSRQ")String ksrq,
                                                                         @Param("JSRQ")String jsrq)throws SQLException;
    /**
     * 获取住院总费用
     */
    CostAggregationDoamin getCostAggregation(@Param("JGID")String jgid, @Param("ZYH")String zyh)throws SQLException;
    /**
     * 获取住院类别
     */
    HospitalizationInfo getZyInfo(@Param("JGID")String jgid,@Param("ZYH")String zyh);
    /**
     * 确认预缴金
     */
    Integer hospitalizationDeposit(@Param("pojo") HospitalizationDepositPojo pojo,
                                   @Param("ZYLB")Integer zylb,@Param("JKXH")long JKXH,@Param("SJHM")String sjhm,
                                   @Param("CZGH")String CZGH
                                   )throws SQLException;
    CostDomain getZyCostMoney(@Param("jgid")String jgid,@Param("zyh")String zyh);
    /**
     * 验证该条预缴金记录是否存在
     */
    Integer verifyHospitalizationDeposit(@Param("JGID")String jgid,@Param("JYLSH")String JYLSH);

    public ZY_BRRYDomain getBRRYById(@Param("jgid")Long jgid,@Param("zyh")Long zyh);

    public GetPrecalculatedFeeDomain getPrecalculatedFee(@Param("jgid")Long jgid,@Param("zyh")Long zyh);

    public Double getTbkk(@Param("jgid")Long jgid,@Param("zyh")Long zyh);

    /**
     * 获取结算次数
     */
    Integer getJscs(@Param("JGID")String jgid,@Param("ZYH")String zyh,@Param("tableName")String tableName);
    /**
     * 验证出院结算信息是否存在
     */
    Integer verifyLeaveHospital(@Param("JGID")String jgid,@Param("FPHM")String fphm);
    /**
     * 提交出院结算信息
     */
    Integer paySettlement(@Param("pojo") PaySettlementPojo pojo,@Param("JSCS") Integer jscs,
                          @Param("ZYLB") Integer zylb,@Param("BRXZ") Integer brxz,@Param("FPHM")Long FPHM);
    /**
     * 提交住院结算明细
     */
    Integer paySettlementDetails(@Param("ZYH") String zyh,@Param("JSCS") Integer jscs,@Param("KSDM") String ksdm,
                                 @Param("FYXM") String fyxm,@Param("JGID") String jgid,@Param("ZJJE") String zjje,
                                 @Param("ZFJE") String zfje,@Param("ZLJE") String zlje);
    /**
     * 获取出院费用
     */
    DischargeSettlementInfoDomain dischargeSettlementInfo(@Param("JGID")String jgid,@Param("BRID")String brid);
    /**
     * 获取诊断信息
     */
    List<DiagnosisDoamin>getDiagnosisInfo(@Param("JGID")String jgid,@Param("JZHM")String jzhm);
    CostDomain getJsje(@Param("JGID")String jgid,@Param("ZYH")Integer zyh);


    /**
     * 获取手术信息
     */
    List<SSXXDomain> getSurgeryInfo(@Param("organizationId")String organizationId,@Param("operationId")String operationId,
                                    @Param("bridList")List<String> brid)throws SQLException;
    
    List<ZY_TBKKDomain> getZY_TBKK(@Param("jgid")Long jgid,@Param("zyh")Long zyh);
    
    /**根据工号 机构id获取员工默认住院类别
     * @param jgid
     * @param ygdm
     * @return
     */
    public Long getMrZylb(@Param("jgid")Long jgid,@Param("ygdm")String ygdm);
    
    public void saveZYjs(ZY_ZYJSDomain zyjs);
    
    public void updateJscsTbkk(@Param("zyh")Long zyh,@Param("jscs")Integer jscs);
    
    public void updateJscsFymx(@Param("zyh")Long zyh,@Param("jscs")Integer jscs);
    
    public void saveZY_JSMX(@Param("zyh")Long zyh,@Param("jscs")Integer jscs);
    
    public void updateJscsBrry(@Param("zyh")Long zyh,@Param("jscs")Integer jscs,@Param("jsrq")Date jsrq);
    List<BridFymx>getBridFymx(@Param("JGID")String jgid,@Param("BRID")String brid,
                              @Param("queryType")Integer queryType,@Param("ZYHM")String zyhm);

    /**
     * 预缴费信息
     */
    PrepareBalance getBalance(@Param("sfzh") String sfzh) throws SQLException;
}
